home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
OTHER_LA
/
YERK__
/
TOOLBOX_
/
PICTURES
< prev
next >
Wrap
Text File
|
1990-08-14
|
2KB
|
55 lines
\ 2.1.87 rfl version
\ 4.28.88 rfl moveto needs work
\ 8.31.88 rfl added theClip to this source
\ 8.14.90 rfl moveto fixed
rect theClip \ global clip rectangle
-1000 dup 1000 dup put: theClip
: +pair { x1 y1 x2 y2 -- x1+y1 x2+y2 } x1 x2 + y1 y2 + ;
\ Interface object for QD picture support
:CLASS Picture <Super Object
Handle picHndl
Int resID \ resource ID if it is a resource
Rect DestRect \ destination rectangle for drawing
\ ( l t r b -- ) Open a new pict with given frame
:M OPEN: Put: destrect 0 abs: destrect call OpenPicture
Put: picHndl ;M
\ ( -- ) terminate this picture definition
:M CLOSE: call ClosePicture ;M
\ ( resID -- )
:M INIT: put: resID ;M
\ load the picture from a resource file
:M GETNEW: 0 int: resID call GetPicture put: picHndl
ptr: picHndl 2+ get: rect put: destRect ;M
\ ( w h -- ) Set size in pixels of dest rect
:M SIZE: getTop: destRect +Pair putBot: destRect ;M
\ ( x y -- ) Move dest rect to given location
:M GOTO: { x y -- } Size: destRect x y putTop: DestRect
Size: self ;M
\ ( -- ) Draw the picture in destRect
:M DRAW: get: picHndl abs: destRect
call DrawPicture ;M
\ ( x y resID -- ) Combines the actions of init:, getNew:, goto: & draw:
:M DISP: init: self getNew: self goto: self draw: self ;M
\ goto to location and draw self
:M MOVETO: ( x y -- ) goto: self draw: self ;M
\ ( -- ) dispose of picture heap
:M KILL: get: picHndl call KillPicture ;M
;CLASS